﻿@model List<Galaxy.Entities.Message>
@section styles{
    <link href="~/lib/AdminLTE/plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" asp-append-version="true" />
    <link href="~/lib/AdminLTE/plugins/iCheck/all.css" rel="stylesheet" asp-append-version="true" />
    <link href="~/lib/AdminLTE/plugins/select2/select2.min.css" rel="stylesheet" asp-append-version="true" />
    <link href="~/css/base.css" rel="stylesheet" asp-append-version="true" />
}
@section scripts{
    <script src="~/lib/AdminLTE/plugins/select2/select2.full.min.js" asp-append-version="true"></script>
    <script src="~/lib/AdminLTE/plugins/iCheck/icheck.min.js" asp-append-version="true"></script>
    <script src="~/js/base-message.js" asp-append-version="true"></script>
    <script src="~/js/base.js" asp-append-version="true"></script>
    <script src="~/view-resources/Views/Message/Trash.js" asp-append-version="true"></script>
}

<div class="content-wrapper" id="mainDiv" style="min-height: 935px;">
    <section class="content-header">
        <h1>消息管理<small>垃圾箱</small></h1>
        <ol class="breadcrumb">
            <li><a href=""><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">系统工具</a></li>
            <li class="active">消息管理</li>
        </ol>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-md-3">
                <button data-btn-type="addMessage" data-flag="new" class="btn btn-primary btn-block margin-bottom">新建消息</button>
                @await Component.InvokeAsync("Message")
                <!--0收件箱， 1发件箱， 2草稿箱， 3回收站-->
                <input type="hidden" id="status" value="3" />
            </div>
            <div class="col-md-9">
                <div class="box box-primary" id="contentBody">
                    <!--收件箱-->

                    <div class="box-body">
                        <div id="message_inbox_table_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                            <div class="row">
                                <div class="col-sm-3">
                                    <div class="dataTables_length" id="message_inbox_table_length">
                                        <label>
                                            <select name="message_inbox_table_length" aria-controls="message_inbox_table" class="form-control input-sm">
                                                <option value="10">10</option>
                                                <option value="20">20</option>
                                                <option value="50">50</option>
                                                <option value="-1">全部</option>
                                            </select> 记录/页
                                        </label>
                                    </div>
                                </div>
                                <div class="col-sm-9">
                                    <div class="dataTables_filter " id="searchDiv" style="">
                                        <input type="hidden" name="receiveUserID" />
                                        <div class="has-feedback form-group">
                                            <input type="search" placeholder="请输入标题" title="主题" name="message.sendSubject" class="form-control input-sm" id="sendSubject" operator="like" likeoption="true">
                                            <span class="glyphicon glyphicon-search form-control-feedback"></span>
                                        </div>
                                        <button type="button" class="btn btn-primary btn-sm" data-callback="enableOrDisableButtons()" data-btn-type="search" title="查询"><i class="fa fa-refresh"></i></button>
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-default btn-sm" data-btn-type="delete" title="删除"><i class="fa fa-trash-o"></i></button>
                                            <button type="button" class="btn btn-default btn-sm" data-btn-type="reply" title="回复"><i class="fa fa-reply"></i></button>
                                            <button type="button" class="btn btn-default btn-sm" data-btn-type="forward" title="转发"><i class="fa fa-share"></i></button>

                                        </div>
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-default btn-sm" data-btn-type="signUnread" title="标记为未读"><i class="fa fa-flag-o"></i></button>
                                            <button type="button" class="btn btn-default btn-sm" data-btn-type="signRead" title="标记为已读"><i class="fa fa-flag text-yellow"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="message_inbox_table" style="border-top: 1px solid rgb(244, 244, 244); width: 100%;" class="table table-border table-striped table-hover dataTable no-footer" role="grid" aria-describedby="message_inbox_table_info">
                                        <thead>
                                            <tr role="row">
						                        <td class="text-left" rowspan="1" colspan="1"><button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></button></td>
                                                <th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="序号">序号</th>
                                                <th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="发送人">发送人</th>
                                                <th class="sorting text-center" tabindex="0" aria-controls="message_inbox_table" rowspan="1" colspan="1" aria-label="主题: activate to sort column ascending">主题</th>
                                                <th class="text-center sorting" tabindex="0" aria-controls="message_inbox_table" rowspan="1" colspan="1" aria-label="发送时间: activate to sort column ascending">发送时间</th>
                                                <th class="sorting_disabled text-center" rowspan="1" colspan="1" aria-label="类型">类型</th>
                                                <th class="text-center sorting" tabindex="0" aria-controls="message_inbox_table" rowspan="1" colspan="1" aria-label="标记: activate to sort column ascending">标记</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            @for (int i = 0; i < Model.Count; i++)
                                            {
                                                <tr id='@Model[i].Id' role="row" class='@(i % 2 == 0 ? "odd" : "even")'>
							                        <td class="text-left">
                                                        <div class="icheckbox_flat-blue" style="position: relative;">
                                                            <input type="checkbox" data-flag="icheck" style="position: absolute; opacity: 0;" />
                                                        </div>
                                                    </td>
                                                    <td class="text-center sorting_1">@((ViewBag.PageIndex - 1) * ViewBag.PageSize + i + 1)</td>
                                                    <td class="text-center sorting_1">@Model[i].Recipients</td>
                                                    <td class=" text-left">
                                                        <a class="text-bold" href='@Url.Content("~/Message/Preview/"+Model[i].Id)'>
                                                            <span data-toggle="tooltip" data-placement="right" data-html="true" title="" data-original-title='@Model[i].Title'>@Model[i].Title</span>
                                                        </a>
                                                    </td>
                                                    <td class="text-center">@Model[i].CreateTime.ToString("yyyy-MM-dd HH:mm")</td>
                                                    <td class="text-left">
                                                        &nbsp;
                                                        @switch (Model[i].MessageType)
                                                        {
                                                            case 0:
                                                                <i class='fa fa-tv text-danger'></i>
                                                                break;
                                                            case 1:
                                                                <i class="fa fa-envelope-o text-info"></i>
                                                                break;
                                                            case 2:
                                                                <i class="fa fa-mobile text-success fa-lg"></i>
                                                                break;
                                                            case 3:
                                                                <i class="fa fa-tv text-danger"></i>  <i class="fa fa-envelope-o text-info"></i>
                                                                break;
                                                            case 4:
                                                                <i class="fa fa-tv text-danger"></i>  <i class="fa fa-mobile text-success fa-lg"></i>
                                                                break;
                                                            default:
                                                                break;
                                                        }
                                                        &nbsp;
                                                    </td>
                                                    <td class="text-center">
                                                        @if (Model[i].Mark == 0)
                                                        {
                                                            <i class='fa fa-star-o text-yellow'></i>
                                                        }
                                                        else
                                                        {
                                                            <i class='fa fa-star text-yellow'></i>
                                                        }
                                                    </td>
                                                </tr>
                                            }
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            @Html.Raw(ViewBag.Page)
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>

